// TerminalSpeedOption.cpp: implementation of the CTerminalSpeedOption class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "AnsiTerminal.h"
#include "TerminalSpeedOption.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

void CTerminalSpeedOption::SetParameters(const char* buf, int bufLen)
{
	//CString params = CString(buf, bufLen);
	if(bufLen < 1) return;
	if((bufLen == 1) && (buf[0] == SEND))
	{
		CArray<char, char> parameters;
		parameters.Add(IS);
		for(int n = 0; n < m_terminalSpeed.GetLength(); n++)
		{
			parameters.Add(m_terminalSpeed[n]);
		}
		m_pTelnetDataSender->SendOptionParameters(OPTION_TYPE, parameters);
	}
	else if(buf[0] == IS)
	{
		m_terminalSpeed = CString(buf + 1, bufLen - 1);
	}
	else
	{
		// unknown param
		afxDump << "@@@ Unknown Param (CTerminalSpeedOption)" << "\n";
		return;
	}
}